module gamrnds
implicit none
contains
function gamrnd(nu,alpha,n)
integer n
double precision nu,alpha,y(n),gamrnd(n)
call drngam(n,nu,y)
gamrnd=y/alpha
end function gamrnd

function gaminv(x,nu,alpha,n)
integer n,i
double precision nu,alpha,x(n),gaminv(n),dgamin

do i=1,n,1
	gaminv(i)=dgamin(x(i),nu)/alpha
end do
end function gaminv

function gamcdf(x,nu,alpha,n)
integer n,i
double precision nu,alpha,x(n),gamcdf(n),dgamdf

do i=1,n,1
	gamcdf(i)=dgamdf(x(i)*alpha,nu)
end do
end function gamcdf
end module gamrnds